import path from 'path'
import fs from 'fs'
import { reject } from 'any-promise';


const readFile = function (src){
  return new Promise((resolve, reject)=>{
    fs.readFile(src, (err, data)=>{
      if(err) reject(err);
      resolve(JSON.parse(data));
    })
  })
}



export default  async (filename) => {
  try {
    let data = await readFile(`./mock/${filename}.json`);
    return data;
  } catch (error) {
    throw error;
  }
  
}